package com.onlineclass.school.controller;

import com.onlineclass.beas.ResultObject;
import com.onlineclass.beas.UserInfo;
import com.onlineclass.school.service.ITecherService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/teacher")
@Log4j2
public class TeacherController {

    @Autowired
    ITecherService iTecherService;


    @RequestMapping("/getteacher")
    public ResultObject getTeacher(){
        List<UserInfo> userInfoList = iTecherService.getteacher();
        ResultObject o = new ResultObject();
        if (userInfoList == null) {
            o.setStatus(404);
            o.setInfo("查寻失败");

            return o;
        } else {
            o.setStatus(1);
            o.setInfo("查寻成功");
            o.setData(userInfoList);
            log.info(String.valueOf(userInfoList));
            return o;
        }
    }
}
